Optimize DatabaseDriver::replacePrefix()

As accepted in the CMS at joomla/joomla-cms@d158e5be074195600b965c21e0794130d9b7fd9c