not quite that simple.
Sure you can easily track when a user logs in, but tracking when they log out is more complex since there are multiple scenarios that can trigger logout:
-click a log out link
-remain on the site idle till the session ends
-close the browser and kill the session.
You can trigger a database update when the logout button is pressed, but it's a lot more difficult to track when the session times out, or is terminated by the browser closing.