... this obviously does a string comparison
No - if the date / time format matches the supported format, MySQL performs an implicit conversion to convert the value to DATETIME based on the column with which it is being compared. The same thing happens with:
WHERE int_column = '1'
... where the string value "1" is converted to INTEGER, since the int_column data int_column is INT, not CHAR / VARCHAR / TEXT.
If you want to explicitly convert the string to DATETIME, the best choice would be the STR_TO_DATE function :
WHERE expires_at <= STR_TO_DATE('2010-10-15 10:00:00', '%Y-%m-%d %H:%i:%s')
OMG Ponies Oct 21 2018-10-10 15:57
source share