UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gOCgvFJjd+A6Z4NAigkIjbplOCnDGDlPg05Tww2inJk='
WHERE
key_id = '7247668b30b15921e59c593afe8a2ea01d7d7ee2356f8930bda1e014d5f18e82'
AND (
token = 'gOCgvFJjd+A6Z4NAigkIjbplOCnDGDlPg05Tww2inJk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)