UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xPeZw6l4egd/7Re3lXAK9z4QNo0lP6mGjf4rfT0ferI=' 
WHERE 
  key_id = 'e51b2a43e2b457451e110a14ba24780a1446b328a03df1ef5705c48b9866f66f' 
  AND (
    token = 'xPeZw6l4egd/7Re3lXAK9z4QNo0lP6mGjf4rfT0ferI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027