Real Madrid have locked down midfielder Federico Valverde with a contract extension running through 2031, securing a core veteran.