UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CWaiKJmfZQ6pU2k4TthT/4zHynnYUkiJfU0AUhQppk0=' 
WHERE 
  key_id = '1b59ec5ee177714d6c3b3adf555a05d4420fee4d9ce2d3d8de396d8ba937162d' 
  AND (
    token = 'CWaiKJmfZQ6pU2k4TthT/4zHynnYUkiJfU0AUhQppk0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048