> What is the relation between mean power and power spectral density? How to convert one to the other ?

The integral over the PSD is the power. That's it.

> For e.g. if my device uses a 2GHz bandwidth, how do I know how much power the device is allowed to transmit ? How to calculate it ?

2 GHz · -3 dBm/MHz = 33 dB + -3 dBm = 30 dBm = 1 W.

It's forbidden, because you mustn't transmit more than -50 dBm on average. So, you're bound by both limits, and either one might kick in. 

You might, however, transmit a 1 ns pulse with a power of 1W, then be silent for -50 dBm - 30 dBm = -80 dB of a nanosecond, so -10 dBs = 0.1s

More realistically, your PSD won't be flat – you're doing anything but a pulsed radar, after all. In that case, assigning of power might be implicit e.g. through transmitter symbol pulse shaping, or explicit, e.g. through subcarrier power allocations according to subcarrier SNR, for example employing the waterfilling algorithm.