if this is for a php script then you can just use
http://us3.php.net/mysql_real_escape_string
Code:
$sql = "update category_text set text='".mysql_real_escape_string("this is a problem because it's got an apostrophe in it")."', keywords='asdf,asdf' where id='1';"
$affected_rows = mysql_query($sql);