Whenever your character measures a collision, you send a message "reset timer".
Have one object with a timer property (which measures in seconds).
When the property exceeds 5.0 you restart the scene (property sensor greater than mode).
When a message with subject "reset timer" is received set the property back to -5 (property actuator Assign mode)
[Edit] just in case the character detects constant collision, I suggest to enable [True Level Triggering] at the collision sensor. This way the message gets constantly send and the timer gets constantly reset.