UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W8ef7kuw6JJGmd0MkW9f0mm14iZdNWE4881g16+8aXA='
WHERE
key_id = 'e3136d71d3f966ba11d73dba841651ac9b3f41e267aaf3ba9dd27f9c94e01646'
AND (
token = 'W8ef7kuw6JJGmd0MkW9f0mm14iZdNWE4881g16+8aXA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)