UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cO2k71fq6meFm02Os3V7MReQzQLNTY0JzUmB0Lndfu8=' 
WHERE 
  key_id = '441fd0a98490a7eb4cf1971e30d745796ce3195273d326d9241804e7f4f61b93' 
  AND (
    token = 'cO2k71fq6meFm02Os3V7MReQzQLNTY0JzUmB0Lndfu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027