I make a distinction between three different forms of upgrading:
Minor Enhancements: Basically the ones that are viable without retooling a shipyard. When a new technology is developed that is relevant for a design that is currently built, I will usually create a copy of the design and swap the one component. Normally this results in a slightly better ship that can be built in the same shipyard. Usually existing ships will be recalled for modification at a convenient time (e.g. during routine overhauls). These modifications are inexpensive and quickly done, so they occur quite frequently, maybe every five years for a given ship (as long as there is a shipyard tooled to it).
However, this is not viable for all components. Some components just form a too large proportion of the ship’s costs so upgrading-without-retooling is impossible (mostly engines, but also sensors for C3I ships). And some components are such that better technology allows them to be smaller or cheaper, rather than increasing their performance characteristics. This is good for new designs, but rarely finds a useful application for exiting designs (which must stay at the same mass, or will become too costly to upgrade without retooling). Examples include armour, but also missile fire controls. Better fire control could reach further, but that is only useful if missiles and active sensors are upgraded at the same time, which stops to be an economical option.
Complete Refits: A complete transformation of an existing ship to an entirely new design. These are often more expensive than building a new design from scratch. But as others have mentioned, task-force training is preserved and there is some value in that, hence I still do it, at least for the core fleet. The only restriction is that the tonnage of the respective designs is not too far apart, or it really gets way to expensive. What typically happens is that from one generation to the next, the tonnage slightly increases (because the industrial base can support bigger ships). Due to the large costs, these refits occur seldom. Normally this happens every 2-3 engine generations, so maybe every 25 years. Only for well trained, important ships.
Civlian Sips will not ever see a refit. However, I use a modular approach for many civilian designs (freighter, colony ships, salvagers, troop transports, jump-gate builders, and jump-tenders), i.e. I build a “power module” (engines, fuel tanks, tractor beam), and attach it to the “mission module” (e.g. cargo holds + cargo handling). The “mission modules” will never be upgraded or scrapped, as these components don’t ever get better with technology, with the exception of armour which can decrease the weight of the module slightly, but not enough to make much of a difference. However the “power modules” are scrapped and (re-)built quite often, maybe every two engine generations. So, even though both modules are technically different ships, you could say that I “upgrade” the civilian designs in a way.