UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xe53s+Nx0d6fmIHLYEDlKX8MxuI+H7t4NBlMzDSTotU=' 
WHERE 
  key_id = '8aa6c1286f2ddb3a76cb8a602164cda4feaa0398b888d54edb3757097489c147' 
  AND (
    token = 'Xe53s+Nx0d6fmIHLYEDlKX8MxuI+H7t4NBlMzDSTotU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041