That's indicative of a failing power supply. Had the same problem on my wife's iMac. It would not restart with the power button unless I unplugged the power cord and then plugged back in.
You need to make sure you have a current and full backup of your boot drive. In my dealings with Apple they had me erase the drive and then reinstall the system without any of my user files. This was to make sure it was a hardware problem rather than a software one.
If your local Apple store has reopened you can make a Genius Bar appointment for a free diagnostic check. It it's determined to be the power supply they will replace it for you. However, you'll probably have to pay for it as it won't be under warranty. If the Apple store isn't open you can probably find an Apple Authorized Service Provider nearby that is.
Bottom line, you might want to erase the drive, install pristine system without any of your files and run to see if it still shuts down or not. You'll have a good idea where to go from there.