To delete all the rows in a table older than a certain time, for example, older than 15 minutes or older than one hour, try below SQL query:

Make sure to have a column in the table that is formatted as MySQL timestamp, then use below MySQL statement to delete rows older than a certain time such as 15 minutes or one hour:

Delete rows older than 15 minutes:

DELETE FROM table_name WHERE time_created < (NOW() - INTERVAL 15 MINUTE)


Delete rows older than one hour:

DELETE FROM table_name WHERE time_created < (NOW() - INTERVAL 1 HOUR)