Optocoupler w/ RasPi & Door Buzzer
I don't see any info on the wiring diagram as to what the current is or even whether it's AC or DC. I would suggest using a small 5-10A relay for this application. You may be able to find a pre-made board with a relay + driver transistor, or if not, there are many such circuits out there. For example: 







simulate this circuit &ndash; Schematic created using CircuitLab

The relay supply can be any convenient voltage from 5V to 24V. Choose R1 so that the base current is about 1/20 the relay (and indicator LED, if any) current. So for a 5V 72mA relay coil you could use 1K or 1.2K. You can put an LED and series resistor in parallel with the relay coil if you want some visual indication of operation. 

Note that if something goes wrong and your buzzer stays energized it might damage the lock solenoid if there is no automatic cutout (hopefully there is). 

A simpler, but more expensive, approach is to use a solid-state relay (SSR) that uses a MOSFET output. For, this Panasonic one:



Which will supply both the isolation and the output switching. It would be a good idea to put a TVS rated at perhaps 48V across the 'contact' (pins 4 and 6, leave 5 open). Like the mechanical relay this will work with either AC or DC, and like the mechanical relay you should consider the consequences of failure (your apartment being unexpectedly unlocked or the lock solenoid being damaged).