You should start by reading and understanding the Blink Without Delay example. That will teach you how to use the millis() function to keep track of events over time.
It's quite simple (if I understand your requirements right):
Someone knocks. Set a variable (unsigned long) to equal millis().
If millis() - the variable you set above > the time interval (10 minutes), then reset you counters etc.
If you only want it to be 10 minutes from the time of the first knock, not the last knock, then you only set your variable if it's 0, and when you time out, set it back to 0 so you can start again.
If you're capable of writing code to recognise the secret knock, then keeping a count of failed attempts and resetting that count after an interval is relatively simple - it's using techniques that you would need to have understood already in order to recognise the secret knock in the first place. So - have you figured out how to recognise the secret knock?