"Probability based sweeping" in place of "time based sweeping"

As mentioned by Rahul I have replaced the time based sweeping of expired session by including a probability factor to the function.
Also the JOIN in sql query has been replaced by multiple queries to do the task separately.