If the laptop shuts down consistently after 30 minutes in Windows/Linux, but runs for longer periods of time in the BIOS, the problem is likely caused by malware. Performing a virus scan may find and remove the malware. If the time isn't consistently 30 minutes, [link|https://www.minitool.com/data-recovery/fix-laptop-overheating-003.html?utm_source=ifixit.com&utm_medium=referral&utm_campaign=View695783|overheating] or a hardware defect may cause the issue.
To access BIOS on your machine, press the F2 key repeatedly as soon as you switch on your laptop. Most of the time, a prompt tells you to press F2 to enter setup, this prompt may be missing depending on your specific system though.
I hope my answer comes in handy for ya.