UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'soetl9k0fdOQRotCadI2MZvYPljMi39PdRAukPpF3fo=' 
WHERE 
  key_id = '333caee2f83f9120d3e4b62f050e06c5ca5489c55f901a451a6a13a31b220295' 
  AND (
    token = 'soetl9k0fdOQRotCadI2MZvYPljMi39PdRAukPpF3fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00084