The message table is just the message cache, you should be able to safely delete the contents of that table (DELETE FROM `messages`;) and then retry the update.
Also, if you are running RoundCube on the same server as the IMAP server, you could disable the message cache entirely in config/main.inc.php.