keep unlocked?

I am creating a keypad garage door opener and so far I am successful with having it unlock activate the relay and lock again but now what I want to add in is a delay for when it locks again but at the same time allowing the keys to work so I can close it again within a couple minutes. example I open the garage door grab the mower and now I wanna close the door by touching # if I use the delay as I have in my code it sits there and counts and doesn't allow me to press any keys.

Don't use delay.