I just noticed something, we used a coupon code that was used in the past and it works fine however if you use the Discount Coupon lookup from the website it shows the old expired coupon code not the current active one?

To fix the issue I manually renamed the expired coupon code via phpmyadmin to something else and now the new active code is showing up.

Question can old expired coupon codes be deleted or will it cause unforeseen database issues? For example if I delete or rename a coupon code as I did will past orders that used that code be affected in anyway? If they CAN be deleted without any issues is there a SQL code that can easily purge all expired coupons from the database?

If they CANNOT be deleted then the discount lookup source code has a bug in it and should address expired coupons if a new one is active with the same name.