UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EdejWJomYpufhnchPKx49pbvkU3urgyzG9mychTffn0='
WHERE
key_id = '1b7ecaf06af25c0ebe7429e2f4ce284968fa0d6563260d3578f67c148ae75393'
AND (
token = 'EdejWJomYpufhnchPKx49pbvkU3urgyzG9mychTffn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)