UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'abYLtinyqljY+KAnqP1CdAwsx5tg9ODOfZv8V6et348='
WHERE
key_id = '77d0a31d3e0a2227459c5c15a5ac0bc99d747fbc26e66e6f3edd02e6e7df5c1e'
AND (
token = 'abYLtinyqljY+KAnqP1CdAwsx5tg9ODOfZv8V6et348='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)