UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e17jw+6AE5QPI5f84uAxJ/QnUC0T8FwPLEj8ZWjOP2E=' 
WHERE 
  key_id = '7389780e33c846c1a2c522a88e26a05caf533caea017976d48f91596a4972459' 
  AND (
    token = 'e17jw+6AE5QPI5f84uAxJ/QnUC0T8FwPLEj8ZWjOP2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048