UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5IlAraBGlkKZ6loOJHy8O9cJYFCxCthN04fhI+lXi9k='
WHERE
key_id = 'cec69d396e8974ebcf3ec4167af5db99d85114ac96280ad105f159d9da059740'
AND (
token = '5IlAraBGlkKZ6loOJHy8O9cJYFCxCthN04fhI+lXi9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)