Have you considered utilizing GrapheneOS' auto reboot feature? Depending on your concerns, this might be just what you need.
Can you elaborate on what you mean "in an unlocked state"? Do you literally mean that the phone is unlocked (for example, the phone is snatched out of your hand while you're using it), or that it is just in AFU (After first unlock) mode?
If you mean the former, the auto reboot feature won't exactly help, if you mean the latter, the auto reboot feature can be very useful, as it will reboot the phone if it hasn't been unlocked for a predetermined amount of time.
What that does is put the phone in BFU (before first unlock) mode, which means that your data is fully encrypted.