UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uN79yNOzXSeO9WzK750C3sIMBA3tjH0rP8NJXaC9+Ok=' 
WHERE 
  key_id = '38de300f1c80eacb18b0786e196cc759eb69df616e2ee156f893efafde3f7eb4' 
  AND (
    token = 'uN79yNOzXSeO9WzK750C3sIMBA3tjH0rP8NJXaC9+Ok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039