diff --git a/smradius/modules/accounting/mod_accounting_sql.pm b/smradius/modules/accounting/mod_accounting_sql.pm
index 16b76bc829c6e3e6d955935eee1a32ead3cde4f1..232dc93c710a7ef08c3b777b37178e183e9b2226 100644
--- a/smradius/modules/accounting/mod_accounting_sql.pm
+++ b/smradius/modules/accounting/mod_accounting_sql.pm
@@ -340,7 +340,7 @@ sub getUsage
 	# If we using caching, check how old the result is
 	if (defined($config->{'accounting_usage_cache_time'})) {
 		my ($res,$val) = cacheGetComplexKeyPair('mod_accounting_sql(getUsage)',$user->{'Username'}."/".$template->{'query'}->{'PeriodKey'});
-		if (defined($val) && $val->{'CachedUntil'} < $user->{'_Internal'}->{'Timestamp-Unix'}) {
+		if (defined($val) && $val->{'CachedUntil'} > $user->{'_Internal'}->{'Timestamp-Unix'}) {
 			return $val;
 		}
 	}