UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+7sNVf8CeWiuKXrz/5eN3zWZKDpmhOaVyfk+4S1S2as='
WHERE
key_id = '8f76fc717f5a74f3656e5ab749bda717a5adfae645b2d27981bf9240806d6c02'
AND (
token = '+7sNVf8CeWiuKXrz/5eN3zWZKDpmhOaVyfk+4S1S2as='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)