UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2RYYxxAqcjCExJ0QoTGB5lW5fiwVrI2C40L18U2niW4='
WHERE
key_id = 'de2ebe83b4952c77dee32cafd77d7ab84acf595dc936bb2ed1bf3727aa64bc58'
AND (
token = '2RYYxxAqcjCExJ0QoTGB5lW5fiwVrI2C40L18U2niW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)