One counter, a handful of buttons and a transistor to do the heavy lifting. Test with an LED first and only fit the solenoid once the sequence behaves.
×1
CD4017 Decade Counter
U1
×6
Push Buttons, momentary — the keypad
S1–S6
×1
Push Button, momentary — re-lock
S7
×1
BC547 NPN Transistor — output driver
Q1
×1
1N4007 Diode — coil flyback
D1
×1
12V Solenoid Lock or Relay
LOCK
×2
100 kΩ Resistors — clock & reset pull-downs
R1, R2
×1
1 kΩ Resistor — transistor base
R5
×1
0.1 µF Capacitor — power-on reset
C1
×1
LED + 220 Ω Resistor — unlocked indicator
LED1, R6
×1
Breadboard
BASE
×—
Jumper Wires
BASE
×1
9–12V Supply
PWR