UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HnJoSB0Poh0ShdKkPUkg0LWwvm+lkomJQmiukPwH/tY='
WHERE
key_id = 'bc3c50055117b1bb6de903f0da7426475755ab01d7f8aa31a2bd2ea738898fe2'
AND (
token = 'HnJoSB0Poh0ShdKkPUkg0LWwvm+lkomJQmiukPwH/tY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)