Making a while-loop timeout

Save the millis() value before the door moves. Then, each time through the while loop check whether the current millis() value minus the start value is greater than the required interval. If so then exit the while loop. If not then go round the while loop again.