One issue you should consider is the amount of time your expiry_date is stored in the time zone of your mysql server. I used the following solutions:
SELECT * FROM `download` WHERE `expiry_date` > NOW();
The solution, however, did not necessarily give me the correct answer I was looking for since the NOW () function is localized in the time zone of the mysql server. If your expiry_dates did not get to a server already localized on your server using NOW (), you will get an incorrect comparison.
In all of our systems, we store timestamps in the database using UTC. Unfortunately, the data center that we host requires the servers to be localized in EST, which could potentially ruin all our comparisons. The solution was to use the UTC_TIMESTAMP () function, which returns the UTC date and time not localized.
SELECT * FROM `download` WHERE `expiry_date` > UTC_TIMESTAMP();
source share