You can always replace a lower-rated system with a higher-rated one, if you have the essence for it. Officially, you would need to pay the full nuyen price for the new system, but only the difference in Essence. For example, if you want to replace your rating 2 Wired Reflexes (¥149,000 and 3.0 essence) with rating 3 Wired Reflexes (¥217,000 and 5.0 essence), they cost the full ¥217,000 but only 2 additional points of essence (b/c removing the original cyberware left a "hole" of 3 essence, and the new ware costs 5).
The Missions FAQ (v1.3, p.27) lets you upgrade a system from a lower rating to a higher rating and/or grade for the price difference plus 20% medical fees. In this example, upgrading your Wired Reflexes to rating 3 from rating 2 would cost (¥217,000 - ¥149,000) x 1.2 = ¥81,600 instead of ¥217,000. This is how we handle it in my campaign. Talk to your GM.
If you're simply removing the old system and/or replacing it with an unrelated one (e.g., replacing Wired Reflexes with Synaptic Boosters), then the old 'ware doesn't give you a break on the nuyen price of the new 'ware, but you can still sell it for 30% of its book price. In this example, you'd get 0.3 x ¥149,000 = ¥44,700 back for your old rating 2 Wired Reflexes; then you pay full price for the Synaptic Boosters. Essence cost works the same: The new ware fills the "hole" left by the old ware before consuming any additional essence.