You can use the millis function to check the current 'time'. If you store this, and later call this function again, by subtracting you can see how much time has been passed. so instead of delay(500)
you use if (millis() - timeStamp >= 500) { ...
to continue your code.
As others said in comments, you also need to debounce to prevent multiple button triggers.
Edit: Debouncing
There is not a library for debouncing (at least not one on the Arduino site), but you can easily copy the needed code from the following sketch: