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