UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '902OFTvJH3iHTQCsEelF9uPE7Jd2+PVyUVcGC5TFo6U='
WHERE
key_id = '51e712d2cd7fbb06d2026a2c18651adaed530dba179f52e3471051c196339832'
AND (
token = '902OFTvJH3iHTQCsEelF9uPE7Jd2+PVyUVcGC5TFo6U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)