RFID timer for auto button push

Hello , i want to trigger one sos button of a GPS tracker after X time if the user don’t cancel the code via RFID card .

My main code is the same as the AccessControl example of MFRC522 library with changes at the relay state (stay LOW at Granted delete delays,HIGH state everywhere ) and a change on pins (swap 4 to 7 ) .

How i can turn on the relay after X time ? (the better way)
3.Read state of pin

I have see the 3 options and try to use them in my code with no luck . i need help to understanding the process The delay make the code waiting ok is out , can enyone help me to understand the to others ?

Its more easy if i use a button as input trigger "if button pressed–> do this "?

The same task its easy to make it with ic 555 or to trigger the ic from arduino , i struggle to use only arduino (i know isnt hard but i have stuck with my tries and research )

Best Regrads

AccessControlmodif.ino (24.2 KB)

Look at the BlinkWithoutDelay example in the IDE. It will show you how to use millis() to track elapsed time your your arduino is still responsive to other things (like reading an RFID tag)