How about you writing the timestamp to the database when the user logs in. Perhaps you have some logic for periodically updating this value if the user is still registered - for example, a page might make an AJAX request to update the value every 5 minutes or something else.
Then, if the value is greater than a certain threshold (say, 1 hour), you can allow re-entry into the system - which, of course, will reset the time stamp and will not allow anyone else to access.
source
share