Catch the key.
With quick reflexes, you shove your hat through the hole in time to rescue the key.