Abu Hurairah (RA) reported Allah's Messenger (ﷺ) as saying: He who took an oath and (later on) found another thing better than that, he should do that which is better, and expiate for the vow (broken by him).
Hadith ReferenceSahih Muslim / The Book of Oaths / Hadith: 1650