Backing up databases used to be challenging or had to be done with SQL management tools. Thanks to new PowerShell commands shipped with SQL server 2012 and SQL server 2012 Express (the latter shipped with Lync 2013), backing up and restoring has become a lot easier.
The script examples given here presume that the Lync backend databases are on an isolated instance (colocation core services and monitoring databases). If not, it would be wise to read up on the list of databases to take backup of at http://technet.microsoft.com/en-us/library/gg398479.aspx. Then, adjust the following scripted examples to back up or restore only the databases needed for Lync.