UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VyRhDA3joth8HyAXu2LsXjCO3sCwupilsswLMBm8nds=' 
WHERE 
  key_id = '471db0a0e2f79e7b8abe5b2f070fefa7fe1bfc2a09df3d1bd974de46e33229c9' 
  AND (
    token = 'VyRhDA3joth8HyAXu2LsXjCO3sCwupilsswLMBm8nds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048