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