The heart of the lock is the 40022 octal counter. When first powered C2 is charged via R5 so the reset input of the counter is kept high. That causes output Q to go high while all the other outputs are low. With the switches wired as shown, when S4 is pressed, the BS170 mosfet is switched on via debouncing network R2/C1, and the 4022 recieves a clock pulse. Also C2 is discharged via R4 and D1, removing the reset signal of the counter, allowing it to advance. The time required for C2 to charge via R5 is the maximum time that can lapse before the next key is pressed in time.
When all keys have been pressed in time and in the correct order, Q7 goes high for about four seconds to drive the unlocking relay etc. You can change the code by reviewing the switches. The code for the lock shown in image is 4-8-0-1-5-7-0. However, the 4022 octal counter can be replaced by a 4017 divide by 10 counter that will make it possible to add two more digits to the combination code.