UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IalUlG6COVSeBax0IVV3g/u5aVAcpXRgLZGthpf4ZG0='
WHERE
key_id = '682f81a5fd1f841d12a9726def1e485504e1a26ce74506fb62c7113c7af5aba0'
AND (
token = 'IalUlG6COVSeBax0IVV3g/u5aVAcpXRgLZGthpf4ZG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)