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