UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HUDq5PCz10xFYcw7U9plRv3IubQnLc8oXbWvVuqeQCs=' 
WHERE 
  key_id = '3ad24d4e2e94a274f7762ac155a806c3d6cb0d78cabf5f272489efdf71b794a5' 
  AND (
    token = 'HUDq5PCz10xFYcw7U9plRv3IubQnLc8oXbWvVuqeQCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037