⚠ Safety note: This guide involves working with electricity. If you're not completely sure about every step, stop and call a licensed professional. Before you start, always switch off the power at the breaker or close the main water/gas valve.
1 Prepare for safe work
Turn off the corresponding fuse, tag it against accidental switching on, and confirm the absence of voltage with a suitable two-pole tester before touching the conductors.

⚠ Warning: Mains voltage can be fatal. If you cannot reliably switch off and confirm the absence of voltage, if the wire colors are unclear, or the installation is damaged, do not proceed on your own.
2 Determine the condition and the cause
Before removal, photograph the wire layout and check that the new outlet matches the box, current, and grounding method.
3 Perform the key check
Inspect the insulation, cross-section, and ends of the conductors. Blackened, brittle, or too short conductors are not for a simple home replacement.
4 Perform the repair or maintenance
Connect the phase, neutral, and protective conductors to the marked terminals, tighten according to instructions, and neatly arrange the wires without pinching them.

? Tip: Photograph the initial state and change only one thing at a time. This will make it easier to determine what really solved the problem.
5 Test the result
Reinstall the covers and protection before turning on the power. Test the function without touching exposed parts; heating, buzzing, sparking, or tripping the protection require an electrician.

When to call a professional: If the job involves changes to the electrical panel, the main gas line, or load-bearing walls/beams — or if you're not sure how it will turn out — this is not a DIY task. Hire a licensed professional.