If you are feeling brave you could do something like this:

    
	$resource = Mage::getSingleton('core/resource');
	$writeConnection = $resource->getConnection('core_write');
	$query = "update core_config_data set value = 'http://domainname/' where path = 'web/unsecure/base_url';";
	$writeConnection->query($query);
	$query = "update core_config_data set value = 'https://domainname/' where path = 'web/secure/base_url';";
	$writeConnection->query($query);