UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'owFTG67WkqxoPvBZQ3S6YgtBRjrgMjQyD0UD0lYclpI=' 
WHERE 
  key_id = '161fb7fb1bb419bcf76afc06d202fbe0f9f8aa56f714f1fad7b368cfb4982a62' 
  AND (
    token = 'owFTG67WkqxoPvBZQ3S6YgtBRjrgMjQyD0UD0lYclpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052