You can either replace it or reboot your computer open it leave it open for a while then closing it using the button if still doesnt work shut down the computer with the drive open and open the computer.
PS make sure your computer recognizes the Cd rom driver
If this happens with all your CDs and everytime, I would suggest you should replace your CD Rom Drive with a new one. After use of some years CD Rom Drives have such problems. Otherwise a software might locking your drive. you should find a tool which unlocks the drive and then press the eject button.
Usually answered in minutes!