Welcome! Your best bet will probably be to use webcore. This is essentially a scripting language for SmartThings and can handle all kinds of stacked conditionals, including time duration.
Setting it up is a little complicated, but there are lots of docs and people who will be glad to help if you have any questions. And once you get into it you’ll find you can do almost anything with it.