Hegyi has penned terms to 2027 and will be sent on-loan to Motherwell.
Valero told the club's website: “I’m so happy that Krisztián has signed a new deal. He is a big talent, who has all the attributes you look for in a goalkeeper. He’s been at West Ham for a long time, and I think a lot of us at the Club believe he’s got everything he needs to go to the very top.
“A player’s first loan moves are always difficult, but he gained good experience last season. Over in Holland, in particular, he did really well and played a lot of games. It was good for him to experience new environments and new competitions, and now he has a big chance up at Motherwell.
“I think it’s a really good move for him. Motherwell are a strong team in a good league, there are some big games in that division, and I’m confident he’ll come back to us in an even stronger position.”