How can a server, which is not available anymore, be removed from the console and from the database?
There is a SQL script to clear the sync pairs in EMW. This script allows you to remove orphaned servers from SQL DB.
Can this script be used in QMM?
The removal of orphaned Exchange servers has been built into the QMM application, therefore no scripting is needed.
Simply right mouse click a server on console and select "Remove server from database".