Self-consistent perturbation theory for dynamics of valence fluctuations