Prioritize automation over another

Hi there, I have bedside lamp in my bedroom and I have two automation to turn it on. One is by motion sensor trigger (on for 1 minute) and second is for opening closet - vibration sensor (on for 3 minutes). How can I please if enter the room and then open closet have my bedside lamp on for 3 minutes? If enter the room then first automation is triggered and if I open closet then on time is not prolonged. Thanks!