Update visa validity before visa interview appointment?

I have my H1B visa stamp (dropbox) scheduled for Oct 2023. When I took my appointment, I had my visa approved until Oct 2024. I got my H1B amended recently and now I have approval until May 2025.
Will I be able to get my visa stamped till May 2025 when I submit my passport for stamping? Or will I get it stamped only for Oct 2024?

I would suggest submitting updated DS-160 to reflect the new I-797 before you go for stamping.

Can I update my DS 160 for the interview appointment that I already have?

Yes, you can submit a new DS-160 with updated information and carry copy of old and new DS-160 to your appointment.