UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '24PCIdnu9bceuCxLYvP+IaejYiozyJY+BMAun4guQQo=' 
WHERE 
  key_id = '475afb23e0b524d692418386d53209eda3c201134aa15c879c0b6dd099ecd97f' 
  AND (
    token = '24PCIdnu9bceuCxLYvP+IaejYiozyJY+BMAun4guQQo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023