UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qds4pbbHHX67nv03HHMM09w4BLUX3to8Nofz5uOm5pU='
WHERE
key_id = 'ddca3178ab64e4ed9f8d98b9cc5259580f1484efe25c9dc6694efddd8995cb0b'
AND (
token = 'Qds4pbbHHX67nv03HHMM09w4BLUX3to8Nofz5uOm5pU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)