I use two ways of doing this:
1) Set up a routine task through cron or task scheduler that cleans old stale sessions every 30-60 minutes. (Some sites like 3-5 minutes, but I don't usually need that type of monitoring).
2) Add a generalized cleanup to the logout page (or any page that you want, for that matter), so people who access that page will also clean up sessions that are stale.
Some people may disagree with number 2, but my logic is that if they are logging out, then they probably won't notice or really care about the 10th-of-a-second query that runs along with their logout script. If lots of people log out, it will be even faster since only a few rows will be cleared at a time.
Your query could be something like:
"delete from sessions where timeout < $time"
The downside is, you have to also update the timeout in the database, per session, each time they click a page.