UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MNCXTeeM7kRYv2k4dw+U0yISDm+gcFM4eknIqB1sMf0='
WHERE
key_id = 'c2ae77fce4cc582a728420adf826f2652f7f3477324b7b4f1835eda91afa43dc'
AND (
token = 'MNCXTeeM7kRYv2k4dw+U0yISDm+gcFM4eknIqB1sMf0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)