MySQL: How to change url in posts from xxx.com to yyy.org?

Instead of replace url directly in mysql db Try with Velvet Blues Update URLs wordpress plugin. It is safe to use this plugin.

Because mysql db has some serialize values for post meta key. In that case your solution will not work proper.

I had used velvet blue update urls plugin many times while migrating wordpress site from one domain to another.

Link For Velvet Blues Update URLs