UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'beZq3aqQcxKi/Q4ykm2Hr07x3AuyiqJ2B2RSzjlvcxI='
WHERE
key_id = '2d4845dbe5e79ec0dd20341d015456f59742e6208537f61317b287d647496aa1'
AND (
token = 'beZq3aqQcxKi/Q4ykm2Hr07x3AuyiqJ2B2RSzjlvcxI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)