get_home_stats() now makes uses of the database instead of logic

Previously, get_home_stats() used logic to decide what tokens
are live/expired/revoked or not using a for loop with theree
test cases, this commit fixes that and uses the database instead.