As far as Islamic Shari`ah is concerned, there is nothing wrong in praying two optional rak`ahs of prayer before the fard (obligatory prayer) of Maghrib, provided there is a sufficient gap between the Adhan and the Iqamah of Maghrib in the mosque you are praying in.
Dr. Muzammil H. Siddiqi, president of the Fiqh Council of North America, states the following: It is allowed, to pray two nafl (optional) rak`ahs or for tahiyyat al-masjid (greeting the mosque) after the Adhan and before the fard (obligatory) prayer at Maghrib time. It is reported in Al-Bukhari that the Companions at the time of Prophet (peace and blessings be upon him) used to pray two rak`ahs after the Maghrib Adhan. According to Imam Malik, it is makruh (reprehensible) to pray at this time because this may cause a delay in the Maghrib Prayer. But Imam Ash-Shafi`i and Imam Ahmad ibn Hanbal considered these two rak`ahs asmustahabb (recommeded). According to the Hanafi school, you are allowed to pray these two rak`ahs as long as you do not miss the first takbir (takbirat al-ihram) of Maghrib congregation.