UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XBnP/6aznhW7T3HHo6L/gBzdxSfBvuXDONbANTdhxig='
WHERE
key_id = '0d52ac627c24ef6900de17b05776c2f3efd5723932edaca7a27d57c008841e06'
AND (
token = 'XBnP/6aznhW7T3HHo6L/gBzdxSfBvuXDONbANTdhxig='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)