UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9f+bi7WA7sQViaGHeEI3k+PXKhftHqLeJHvfHa2r94s='
WHERE
key_id = '347c21b90ccdaed06e83d6633528d4120a2af2deca91618e601a1c9203b44970'
AND (
token = '9f+bi7WA7sQViaGHeEI3k+PXKhftHqLeJHvfHa2r94s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)