UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tg6J9DxKAwJzLaxPV1joU7hicXDIESAFiGdYQcME6ZM=' 
WHERE 
  key_id = '7c601d110f755497baadd619392cf9f976aa1f564c903647b0ebdfc63400e77e' 
  AND (
    token = 'tg6J9DxKAwJzLaxPV1joU7hicXDIESAFiGdYQcME6ZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040