1st create a variable with initial value of 0.
As soon as the player collects the key set the value of this variable to 1.
At the event that opens the door add a new condition to check the value of variable.
For instance:
Player on collision with door || Go to Layout
Variable = 1 ||