Delete rows in batches without locking the table

-- repeat until zero rows are affected
DELETE FROM sessions
 WHERE last_seen < NOW() - INTERVAL 30 DAY
 LIMIT 5000;