订单的Magento错误SQLSTATE [23000]:完整性约束违规:1062重复条目'691-0-1'用于关键'PRIMARY'

My customers getting the error bellow when they place an order. Orders go through, payments being taken but not inventory. Inventory stays same. Result of this customers order again. But then they are able to order without an error.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '691-0-1' for key 'PRIMARY' 

I tried to repair tables, clean the cache, full index but this error comes back. This wasn't happening before. I checked catalog_product_entitiy table for entitiy_id 691 it looks normal.

This happens with two different payment method. Paypal and realex. I have checked almost everything.

magento 1.8.1 CE

This error can be solved by disabling the unique indexes check.

In the app/etc/config.xml, change this

SET NAMES utf8

to this

SET NAMES utf8; SET FOREIGN_KEY_CHECKS=0; SET UNIQUE_CHECKS=0;