Hi
What i would do is to run a cron script that goes through the database and deletes the records that belongs to the orders that are over 30 days old.
Like this:
SELECT * from orders WHERE TO_DAYS(NOW()) - TO_DAYS(Orderdate) > 30 AND Active ='Y';
Do loop here to delete the records.
Hope this helps
Tom