[Newbie] Controlling a gate door lock

Hi.

I am very new to the Arduino world and electronics.
I have no problem with the programming part, only with the hardware part.

I need to control a 24V DC door lock which only has 2 pins: applying voltage to the pins makes the latch come out and inverting the pins makes the latch recoil.

I need to connect this lock to a gate motor controller than sends a 24v DC signal to the lock when it needs to open, and removes that signal when it wants it to close. Basically the motor sends an on to open the lock and an off to close it.

Is there any way I can get an arduino to adapt the signals of the motor controller to the lock?

Thanks

Regards,
Mike