UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vw5UVDSuEb7pHAX9cK2FBP0AKrmyWM01GSfyJDrm6iU=' 
WHERE 
  key_id = '9bfa839f8b1070980ce2b21f28dab5c6bc084c629e11e311443a8ac17d356d14' 
  AND (
    token = 'vw5UVDSuEb7pHAX9cK2FBP0AKrmyWM01GSfyJDrm6iU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034