thats a pretty fugly style with all those escapes. The only escape you need is for timestamp which is a reserved keyword
Code:
$query = "UPDATE sms.messages_import SET `timestamp` = NOW, status=2 WHERE messages_import.id=$id";
You also don't need LIMIT 1, since the id is unique (in most cases anyway)