UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O7pze/XCfyQCQKvG18qo3A3mp31qsBmCQYvCLx4vczk='
WHERE
key_id = 'b07b03e6695556edc103f61c36891f3d86918c1b271ef672efe8e3d9baba3cf3'
AND (
token = 'O7pze/XCfyQCQKvG18qo3A3mp31qsBmCQYvCLx4vczk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)