A court-ordered eviction (lanzamiento judicial) is the act in which, by order of the court, a home or business premises is cleared and possession is handed to whoever is entitled to it.
It is the final stage of proceedings such as an eviction (desahucio). The Ley de Enjuiciamiento Civil (Spanish Civil Procedure Act) governs the handover of real property in its article 703. The day and time are set by the court, and the act is led by the court officials (comisión judicial), with the owner or their representative present.
The locksmith has a very specific role: opening the door if nobody hands over the keys, always when the court officials say so, and changing the lock so that nobody else can get in. Afterwards, many homes stand empty for a while and it is worth protecting them.
For any questions about the proceedings, ask your lawyer or your court representative (procurador). What we do on that day is explained on our lock change after a court-ordered eviction page.