How to move installed modules from /sites/all/modules/* to /sites/all/contrib/modules/* I have been searching for the answers to this question with no luck at all.
From what I observe in the database structure, the location to the modules are specified in the 'system' table.
The only solution I have is to write an SQL query to update the 'filename' column.

Is there a better/cleaner solution in solving this, for eg., a contrib module?
You only need to move your modules to the your new location and rebuild the regisry. When the registry rebuilds the path to the modules will be updated. Check registry_rebuild(). 


  Rescans all code in modules or includes directories, storing the location of each interface or class in the database.


Although, I would recommend you to backup you database before testing this.

If you are using drush you could also rebuild the registry using the following command:

drush cc registry


You can also install the registry_rebuild command for drush:

// install registry_rebuild
drush dl registry_rebuild
// rebuild the registry
drush rr