UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K8XnmKNrbkMwlZ2HpxKooGwl014adiGJZjsqMOl6aHM='
WHERE
key_id = 'cd5b18c7b08631150654aa75bf7b558c02e5772e8df641775fc61e13fb05ee8e'
AND (
token = 'K8XnmKNrbkMwlZ2HpxKooGwl014adiGJZjsqMOl6aHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)