From Sahih Muslim (Hadith 4273):
Abu Huraira 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)
Reference: Muslim 4273