-- deactivate all abandoned shopping carts belonging to noone
UPDATE sales_flat_quote
SET is_active = 0
AND updated_at < '2012-12-05';

-- remove all deactivated shopping carts
DELETE FROM sales_flat_quote WHERE is_active = 0;