UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6kJwUmAPxDyupzwOY0d2Y+hw/gtQK5f0nR4y7nhNYsY=' 
WHERE 
  key_id = '12eca3ddfd09ab6c89307af498ceb77c67f204afbb0bce0244e408a313670357' 
  AND (
    token = '6kJwUmAPxDyupzwOY0d2Y+hw/gtQK5f0nR4y7nhNYsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036