UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r0ExgtJ/lYNbZu3nhMRydefxYaqV7FihGlvWR1j8GWQ=' 
WHERE 
  key_id = '4745aece3de6f2b8cdc21b9a9a98ad589481b5683c673a4db85fb614f03e9ec8' 
  AND (
    token = 'r0ExgtJ/lYNbZu3nhMRydefxYaqV7FihGlvWR1j8GWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032