The following statement counts how many records in a table of payments are more than 30 days overdue.

count for date() - LAST_PAY > 30 to nOver30