CODED LOCK, with different personal number, each number has its code

Once you have the keypad and code validation figured out, you may like to explore STATE MACHINES

This will make it much easier for you to 'coordinate' your locks operation.
Allowing timeout, incomplete key entries etc to ensure the lock doesn't get into unexpected states.

As a lock, you may also like to explore using the WDT in future to avoid any unexpected freezes in your code - that will reset the system to a known (locked/waiting for keypad state) when something goes wrong.

Perhaps a push-button input to allow emergency unlock from the 'inside' of the room...