UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nIlVj1JL/r4V7caKMAODkpcsbJtXBv8txhcKWvokRRk='
WHERE
key_id = 'b7c86d5a886b68980b7734628228a1cd4b7c95a3349fd61f236a505df4ec5998'
AND (
token = 'nIlVj1JL/r4V7caKMAODkpcsbJtXBv8txhcKWvokRRk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)